package com.example.smartwaterapi.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Map;

/**
 * 每日统计实体类
 */
@Data
@TableName(value = "daily_stats", autoResultMap = true)
public class DailyStats implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 统计日期
     */
    private LocalDate statDate;

    /**
     * 总饮水量(ml)
     */
    private Integer totalAmount;

    /**
     * 目标量(ml)
     */
    private Integer goalAmount;

    /**
     * 记录次数
     */
    private Integer recordCount;

    /**
     * 达标率(%)
     */
    private BigDecimal achievementRate;

    /**
     * 首次饮水时间
     */
    private LocalTime firstDrinkTime;

    /**
     * 最后饮水时间
     */
    private LocalTime lastDrinkTime;

    /**
     * 每小时数据
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, Integer> hourlyData;

    /**
     * 饮品类型分布
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Map<String, Integer> drinkTypes;

    /**
     * 健康评分(0-100)
     */
    private Integer healthScore;

    /**
     * 规律性评分(0-100)
     */
    private Integer regularityScore;

    /**
     * 创建时间
     */
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    private LocalDateTime updatedAt;
} 